import {wechatshare} from '@/common/api/pool.js'
var jweixin = require('@/components/jweixin-module/index.js');
export const wexinshare = (data) => { // 查询公司列表
	var url = location.href.split('#')[0];
	var urlx = url;
	console.log(JSON.stringify(url));		
	wechatshare({'url':urlx}).then(res=>{
		console.log(res)
	    console.log(res.data)
		var appId = res.data.appid;
		var timestamp = res.data.timestamp;
		var nonceStr = res.data.noncestr;
		var signature = res.data.signature;
		jweixin.config({
			//debug: true,
			appId: appId,
			timestamp: timestamp,
			nonceStr: nonceStr,
			signature: signature,
			jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline']
		});
		jweixin.ready(function() {
			jweixin.checkJsApi({
				jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline']
			});
			var shareData = {
				title: data.title,
				desc: data.desc,
				link: data.link,
				shareUrl: data.link,
				imgUrl: data.img,
			};
			jweixin.onMenuShareAppMessage(shareData); //分享好友
			jweixin.onMenuShareTimeline(shareData); //分享朋友圈
		});
	})
}